In [1]:
def is_palindrome(s):
    """ (str) -> bool

    Return True if and only if s is a palindrome

    >>> is_palindrome('noon')
    True
    >>> is_palindrome('racecar')
    True
    >>> is_palindrome('dented')
    False
    """
    
    return s == s[::-1]

Include this code for testing, then comment it out when no longer needed.


In [2]:
if __name__ == '__main__':
    import doctest
    print (doctest.testmod())


TestResults(failed=0, attempted=3)